#include "lcd.h"
#include <dlfcn.h>

int main(int argc, char const *argv[]) // ./a.out xx.jpg
{
    if(argc != 2)
    {
        printf("请指定一张JPEG图片\n");
        exit(0);
    }

    // 1. 初始化LCD
    struct LCD_info lcdinfo;
    init_LCD(&lcdinfo);
    clear_LCD(&lcdinfo, LCD_BLACK);

    // 获取图片格式并自动链接相应库
    void *handle;
    if (strstr(argv[1], ".bmp"))
    {
        handle = dlopen("libbmp.so", RTLD_NOW);
        if (!handle)
        {
            perror("the libbmp open is failed");
            exit(0);
        }
    }
    if (strstr(argv[1], ".jpg") || strstr(argv[1], ".jpeg"))
    {
        handle = dlopen("libjpg.so", RTLD_NOW);
        if (!handle)
        {
            perror("the libjpg open is failed");
            exit(0);
        }
    }
    
    // 2. 显示图像
    void (*display)(const char*, const struct LCD_info*, uint8_t);
    display = dlsym(handle, "display");

    display(argv[1], &lcdinfo, 0);

    // 3. 释放资源
    relese_LCD(&lcdinfo);

    printf("需要额外下载第三方JPEG库");

    return 0;
}

非常好的代码!
